package com.dubbo.consumer.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dubbo.provider.service.ProviderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 消费者控制器
 * @author zhu_jinsheng
 * @version 1.0
 * @date 2020/7/2 15:44
 */
@RestController
public class ConsumerController {

    /**
     * 使用兼容注入，可以使用dubbo原生注解@Reference注入
     */
    @Reference
    private ProviderService service;

    @GetMapping(value = "/hello/{name}")
    public String hello(@PathVariable String name){
        return service.sayHello(name);
    }
}
